import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class GestureDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('手势处理示例'),
        centerTitle: true,
      ),
      body: GestureDetector(
        onTapDown: (detail) {
          ScaffoldMessenger.of(context)
              .showSnackBar(SnackBar(content: Text('按下按钮')));
        },
        onTapUp: (details) {
          ScaffoldMessenger.of(context)
              .showSnackBar(SnackBar(content: Text('松开按钮')));
        },
        onTap: () {
          ScaffoldMessenger.of(context)
              .showSnackBar(SnackBar(content: Text('点击按钮')));
        },
        child: Center(
          child: Container(
            padding: EdgeInsets.all(12.0),
            decoration: BoxDecoration(
              color: Theme.of(context).buttonColor,
              borderRadius: BorderRadius.circular(5.0)
            ),
            child: Text('测试按钮'),
          ),
        ),
      ),
    );
  }
}
